# Makefile for tests
obj-m += testcase_l0_mem_pool.o
testcase_l0_mem_pool-objs := test_framework.o \
                         test_env.o \
                         test_allocation.o \
                         test_numa.o \
                         test_fix_allocator.o \
                         test_flex_allocator.o \
                         test_error_handling.o \
                         test_concurrent.o \
                         test_stress.o \
                         test_integration.o \
                         test_performance.o \
                         test_stability.o \
                         test_interrupt.o \
                         test_api_validation.o \
                         test_l0_mem_pool.o
                         
KBUILD_EXTRA_SYMBOLS += /home/yyy/l0/code/hisi_l0_mem_pool/Module.symvers

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

EXTRA_CFLAGS += -I/home/yyy/l0/code/hisi_l0_mem_pool
EXTRA_CFLAGS += -I/usr/src/kernels/5.10.0_l0_mwp+/include/linux/

# Add required kernel libraries
ccflags-y += -I$(PWD)/..

all:
	$(MAKE) -C $(KDIR) M=$(PWD) modules

clean:
	$(MAKE) -C $(KDIR) M=$(PWD) clean

test:
	@echo "To run tests:"
	@echo "1. sudo insmod ../hisi_l0_mem_pool.ko"
	@echo "2. sudo insmod test_l0_mem_pool.ko"
	@echo "3. cat /proc/l0_mem_pool_test"
	@echo "4. sudo rmmod test_l0_mem_pool"
	@echo "5. sudo rmmod hisi_l0_mem_pool"